home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / examples / dtksh / TransEventTest.z / TransEventTest
Encoding:
Text File  |  2003-11-18  |  3.5 KB  |  103 lines

  1. #! /usr/dt/bin/dtksh
  2. #
  3. # TransEventTest
  4. #
  5. # Copyright 2000, Silicon Graphics, Inc.
  6. # ALL RIGHTS RESERVED
  7. # UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8. # States.   Use of a copyright notice is precautionary only and does not
  9. # imply publication or disclosure.
  10. #
  11. # U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12. # Use, duplication or disclosure by the Government is subject to restrictions
  13. # as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14. # in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15. # in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16. # Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17. # 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18. #
  19. # THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20. # INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21. # DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22. # PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23. # GRAPHICS, INC.
  24. #
  25. ##########################################################################
  26. #  (c) Copyright 1993, 1994 Hewlett-Packard Company    
  27. #  (c) Copyright 1993, 1994 International Business Machines Corp.
  28. #  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. #  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  30. #      Novell, Inc.
  31. ##########################################################################
  32.  
  33.  
  34. #
  35. # This sample shell script verifies that the augment and override
  36. # capabilities for translations work as expected.  Since augmenting
  37. # a translation does not replace an existing translation, the first
  38. # pushbutton should only use our button3 translation.  Since overriding
  39. # a translation replaces an existing translation, the second pushbutton
  40. # should use both our Enter and button1 translations.
  41. #
  42. # It also demonstrates access to the TRANSLATION_EVENT convenience
  43. # environment variable.
  44. #
  45.  
  46. # EnterNotify handler
  47. Enter()
  48. {
  49.    echo EnterNotify
  50.    echo "Event = "${TRANSLATION_EVENT}
  51.    echo "Event.type = "${TRANSLATION_EVENT.TYPE}
  52.    echo "Event.xany.window = "${TRANSLATION_EVENT.XANY.WINDOW}
  53. }
  54.  
  55. # ButtonDown handler; $1 indicates which button
  56. BtnDown()
  57. {
  58.    echo "ButtonDown ("$1")"
  59.    echo "Event = "${TRANSLATION_EVENT}
  60.    echo "Event.type = "${TRANSLATION_EVENT.TYPE}
  61.    echo "Event.xany.window = "${TRANSLATION_EVENT.XANY.WINDOW}
  62.    echo "Event.xbutton.x = "${TRANSLATION_EVENT.XBUTTON.X}
  63.    echo "Event.xbutton.y = "${TRANSLATION_EVENT.XBUTTON.Y}
  64. }
  65.  
  66. # Default activate callback for the pushbuttons; should only get called
  67. # for the first pushbutton (augmented one).
  68. Activate()
  69. {
  70.    echo "Activate ("$1")"
  71. }
  72.  
  73.  
  74. ######################### Create the Main UI #################################
  75.  
  76. XtInitialize TOPLEVEL transEventTest TransEventTest "$0" "$@"
  77. XtSetValues $TOPLEVEL allowShellResize:True
  78.  
  79. XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL \
  80.          orientation:HORIZONTAL \
  81.          numColumns:2 \
  82.          packing:PACK_COLUMN 
  83.  
  84. XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
  85.     labelString:"Augmented Button" \
  86.     translations:'#augment
  87.          <EnterNotify>:ksh_eval("Enter") 
  88.          <Btn1Down>:ksh_eval("BtnDown 1")
  89.          <Btn3Down>:ksh_eval("BtnDown 3")'
  90. XtAddCallback $PB1 activateCallback "Activate 1"
  91.  
  92. XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
  93.     labelString:"Overridden Button" \
  94.     translations:'#override
  95.          <EnterNotify>:ksh_eval("Enter") 
  96.         <Btn1Down>:ksh_eval("BtnDown 1")'
  97. XtAddCallback $PB2 activateCallback "Activate 2"
  98.  
  99. XtRealizeWidget $TOPLEVEL
  100.  
  101. XtMainLoop
  102.